package com.gmail.bloim.serg.acmbuilder;

import javax.xml.bind.annotation.*;
import java.util.List;

/**
 * User: Администратор
 * Date: 27.04.13
 * Time: 15:15
 */
@XmlRootElement(name = "build")
public class BuildConfiguration {
    private String destination;
    private List<SourceFile> fileSources;
    private List<SourceDir> dirSources;

    public String getDestination() {
        return destination;
    }

    @XmlElement(name = "destination")
    public void setDestination(String destination) {
        this.destination = destination;
    }

    public List<SourceDir> getDirSources() {
        return dirSources;
    }

    @XmlElement
    public void setSources(Sources sources) {
        fileSources = sources.files;
        dirSources = sources.dirs;
    }

    public List<SourceFile> getFileSources() {
        return fileSources;
    }


}

@XmlRootElement
class Sources {
    @XmlElement(name = "file")
    public List<SourceFile> files;
    @XmlElement(name = "dir")
    public List<SourceDir> dirs;
}

@XmlRootElement
class SourceDir {
    private boolean reqursive = false;
    private String path;

    boolean isReqursive() {
        return reqursive;
    }

    @XmlAttribute(name = "recursive", required = false)
    void setReqursive(boolean reqursive) {
        this.reqursive = reqursive;
    }

    String getPath() {
        return path;
    }

    @XmlValue
    void setPath(String path) {
        this.path = path;
    }
}

@XmlRootElement
class SourceFile {
    private String path;

    String getPath() {
        return path;
    }

    @XmlValue
    void setPath(String path) {
        this.path = path;
    }
}